<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width">
  <title>Title</title>
  <style>
    .note {
      background: #fff;
      border-radius: 16px;
      padding: 0 16px 16px 16px;
      margin-top: 30px;
      border-top: 2px solid #ccc;
      box-shadow: 0 0 16px -12px #333 inset;
    }
    .note h2 {
      background: #f0f0f0;
      padding: 8px 20px;
      font-weight: normal;
      border-radius: 25px;
    }
    .note h4 {
      margin: 0;
    }
    .note p {
      line-height: 24px;
      margin: 0;
      color: #555;
    }
    .note-item {
      margin-top: 12px;
    }
    [v-cloak] {
      display: none;
    }
  </style>
</head>
<body>
<header></header>
<div id="app">
  <div v-cloak>
    <div v-if="on">v-if</div>
    <div v-else>v-else</div>
    <div v-for="(item, index) in 3">{{index}}:{{item}}</div>
    <div v-for="(item, index) in arr">{{index}}. {{item.name}}</div>
    <div v-for="(value, key, index) in json">{{index}}. {{key}}: {{value}}</div>
    <button @click="on = !on" :id="json.name">小按钮</button>
    <button @click="message = 123" :id="json.name">改变message</button>
    <div v-pre>{{message}}</div>
    <div v-cloak>{{message}}</div>
    <div v-html="message"></div>
    <div v-once>{{message}}</div>
  </div>
  <div class="note">
    <h2>课程笔记</h2>
    <div class="note-item">
      <h4>1. 默认指令有哪些？</h4>
      <p>默认指令有v-text, v-html, v-show, v-if, v-else, v-else-if, v-for, v-on, v-bind, v-model, v-slot, v-pre, v-cloak, v-once</p>
    </div>
    <div class="note-item">
      <h4>2. 如何自定义指令？</h4>
      <p>自定义指令分为定义全局指令和组件内部指令</p>
    </div>
    <div class="note-item">
      <h4>3. 注意点</h4>
      <p>v-html存在xss攻击风险，应尽量避免使用;v-slot下期讲解</p>
    </div>
  </div>
</div>
<footer></footer>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
  (function () {
    new Vue({
      el: '#app',
      data: {
        on: false,
        arr: [
          {name: '小明'},
          {name: '小李'},
          {name: '小大'}
        ],
        json: {
          name: '小明',
          age: 18
        },
        message: '<i>Hello World</i>'
      }
    })
  })()
</script>
</body>
</html>
